package day6.fight.SmartHome;

public class SmartHomeControl {
    JD jds[]=new JD[4];
    private static final  SmartHomeControl s1=new SmartHomeControl();
    private SmartHomeControl(){}

    /*public  SmartHomeControl(JD jds)
    {
        System.out.println("控制开关系统正在开启开启");
        jds.changeStatus();
    }
    */
    public  void Control(JD jds)
    {
        //System.out.println("控制开关系统正在开启开启");

        System.out.println("您控制的家电是："+jds.getName()+" 当前状态是："+jds.isStatus()+" 现在状态是"+!jds.isStatus());
        jds.changeStatus();
    }
        public void printAll(JD[]jds)
         {
           this.jds=jds;
           for(int i=0;i<jds.length;i++)
             {
                 System.out.println("设备名字是："+jds[i].getName()+" 状态为："+(jds[i].isStatus()?"开着":"关着"));
                 //System.out.println("设备名字是：" + jds[i].getName() + " 状态为：" + (jds[i].isStatus() ? "开着" : "关着"));
             }
         }

    public static SmartHomeControl getS1() {
        return s1;
    }
}
